# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 96
n 96(None)[return cached_data['val']
]:
	i: 59(), 95()
	o: 

nname: 95
n 95(None)[]:
	i: 0&29&46(f)
	o: 96()

nname: 59
n 59(None)[cached_data['val'] = fn(*args, **kw)
cached_data['timestamp'] = time()
]:
	i: 0&29&46(t)
	o: 96()

nname: 0&29&46
n 0&29&46(now > cached_data['timestamp'] + validity or cached_data['val'] is None and not_null is True)[now = time()
]:
	i: 
	o: 59(t), 95(f)

nname: 0&29&46
n 0&29&46(None)[now = time()
if now > cached_data['timestamp'] + validity or cached_data['val'] is None and not_null is True:
	cached_data['val'] = fn(*args, **kw)
	cached_data['timestamp'] = time()
return cached_data['val']
]:
	i: 
	o: 

self.nodes: {'0&29&46': <unpyclib.structure.node instance at 0xb75c2eec>}
nname: 0
n 0(None)[self.reset(fn)
cached_data = self._ClassCache__cache[fn]
def cache_decoration(*args, **args):
	now = time()
	if now > cached_data['timestamp'] + validity or cached_data['val'] is None and not_null is True:
		cached_data['val'] = fn(*args, **kw)
		cached_data['timestamp'] = time()
	return cached_data['val']

return cache_decoration
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75c24cc>}
nname: 0
n 0(None)[def decorator(fn):
	self.reset(fn)
	cached_data = self._ClassCache__cache[fn]
	def cache_decoration(*args, **args):
		now = time()
		if now > cached_data['timestamp'] + validity or cached_data['val'] is None and not_null is True:
			cached_data['val'] = fn(*args, **kw)
			cached_data['timestamp'] = time()
		return cached_data['val']

	return cache_decoration

return decorator
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75bceac>}
nname: 0
n 0(None)[self._ClassCache__cache[fn] = dict(timestamp=0, val=None)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75bcfac>}
nname: 6
n 6(None)[__doc__ = " Decorator for caching function result during <validity>\n    float(validity): expressed in seconds\n    BUG/LIMITATION:\n        parameters are not checked at all, you'r warned !\n        (You probably don't want to use that on variable parameters calls)\n    "
_ClassCache__cache = dict()
def __call__(self, validity=1.0, not_null=False):
	def decorator(fn):
		self.reset(fn)
		cached_data = self._ClassCache__cache[fn]
		def cache_decoration(*args, **args):
			now = time()
			if now > cached_data['timestamp'] + validity or cached_data['val'] is None and not_null is True:
				cached_data['val'] = fn(*args, **kw)
				cached_data['timestamp'] = time()
			return cached_data['val']

		return cache_decoration

	return decorator

def reset(self, fn):
	self._ClassCache__cache[fn] = dict(timestamp=0, val=None)
	return None

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb75bc86c>}
nname: 0
n 0(None)[from __future__ import absolute_import
from peewee.gettime import time
class ClassCache(object):
	__doc__ = " Decorator for caching function result during <validity>\n    float(validity): expressed in seconds\n    BUG/LIMITATION:\n        parameters are not checked at all, you'r warned !\n        (You probably don't want to use that on variable parameters calls)\n    "
	_ClassCache__cache = dict()
	def __call__(self, validity=1.0, not_null=False):
		def decorator(fn):
			self.reset(fn)
			cached_data = self._ClassCache__cache[fn]
			def cache_decoration(*args, **args):
				now = time()
				if now > cached_data['timestamp'] + validity or cached_data['val'] is None and not_null is True:
					cached_data['val'] = fn(*args, **kw)
					cached_data['timestamp'] = time()
				return cached_data['val']

			return cache_decoration

		return decorator

	def reset(self, fn):
		self._ClassCache__cache[fn] = dict(timestamp=0, val=None)
		return None



cache_result = ClassCache()
__all__ = ['cache_result']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75b4e2c>}
from __future__ import absolute_import
from peewee.gettime import time
class ClassCache(object):
	__doc__ = " Decorator for caching function result during <validity>\n    float(validity): expressed in seconds\n    BUG/LIMITATION:\n        parameters are not checked at all, you'r warned !\n        (You probably don't want to use that on variable parameters calls)\n    "
	_ClassCache__cache = dict()
	def __call__(self, validity=1.0, not_null=False):
		def decorator(fn):
			self.reset(fn)
			cached_data = self._ClassCache__cache[fn]
			def cache_decoration(*args, **args):
				now = time()
				if now > cached_data['timestamp'] + validity or cached_data['val'] is None and not_null is True:
					cached_data['val'] = fn(*args, **kw)
					cached_data['timestamp'] = time()
				return cached_data['val']

			return cache_decoration

		return decorator

	def reset(self, fn):
		self._ClassCache__cache[fn] = dict(timestamp=0, val=None)
		return None



cache_result = ClassCache()
__all__ = ['cache_result']
